<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<link rel="apple-touch-icon" sizes="76x76" href="./assets/img/favicon.ico">
<link rel="icon" type="image/png" href="./assets/img/favicon.ico">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>数据资产管理平台</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport'/>

<!-- Google Font -->



<!-- Main CSS -->
<link href="./assets/css/main.css" rel="stylesheet"/>
<link href="./assets/layui/css/layui.css" rel="stylesheet">
<!-- Animation CSS -->
<link href="vendor/aos.css" rel="stylesheet"/>

</head>

<body>



<!-- Main -->
<div class="d-md-flex h-md-100 align-items-center">
	<div class="col-md-6 p-0 bg-indigo h-md-100" style="background-image: url(./assets/img/demo/banner1.jpg);background-size: cover;">
		<div class="text-white d-md-flex align-items-center h-100 p-5 text-center justify-content-center">
			<div class="logoarea pt-5 pb-5">
				<p>
					<!-- <i class="fa fa-anchor fa-3x"></i> -->
				</p>
				<h1 class="mb-0 mt-3 display-4">数据资产管理平台</h1>
				<h5 class="mb-4 font-weight-light"></h5>

			</div>
		</div>
	</div>
	<div class="col-md-6 p-0 bg-white h-md-100 loginarea">

		<div class="d-md-flex align-items-center h-md-100 p-5 justify-content-center">
			<form class="border rounded p-5" id="form1">
				<h3 class="mb-4 text-center">账号认证</h3>

				<div class="form-group" style="display: flex;">
					<label style="width: 100px;">认证角色:</label>
					<select class="form-control" id="slectRole">
<!--						<option value="1">个人</option>-->
<!--						<option value="2">私人企业</option>-->
<!--						<option value="3">国有重点企业</option>-->
<!--						<option value="4">组织机构</option>-->
<!--						<option value="5">事业单位</option>-->
<!--						<option value="6">普通局委办</option>-->
<!--						<option value="7">权力机构</option>-->
						<option value="1">个人</option>
						<option value="2">私人企业</option>
						<option value="3">国有企业</option>
						<option value="4">事业单位</option>
						<option value="5">政府部门</option>
						<option value="6">社会组织</option>
					</select>
				</div>
				<div>
					<div class="form-group" style="display: flex;">
						<label style="width: 100px;" class="personName1">真实姓名:</label>
						<label style="width: 100px;" class="personName2 disabledNone">法人姓名:</label>
						<input type="text" class="form-control" id="personNameInput" required="">
					</div>
				</div>
				<div id="personID">
					<div class="form-group" style="display: flex;">
						<label style="width: 100px;"><span class="inCharge disabledNone">负责人</span>身份证图(正面):</label><input type="file" class="form-control" accept="image/*" style="font-size: 13px;" value="请选择上传图片" id="personIDFront" >
					</div>
					<div class="form-group" style="display: flex;">
						<label style="width: 100px;"><span class="inCharge disabledNone">负责人</span>身份证图(背面):</label><input type="file" class="form-control" accept="image/*" style="font-size: 13px;" value="请选择上传图片" id="personIDBack">
					</div>
				</div>
				<div id="License" class="disabledNone">
					<div class="form-group" style="display: flex;">
						<label style="width: 100px;">营业执照图片:</label><input type="file" class="form-control" accept="image/*" style="font-size: 13px;" value="请选择上传图片" id="LicenseInput">
					</div>
				</div>
				<div id="certificate" class="disabledNone">
					<div class="form-group" style="display: flex;">
						<label style="width: 100px;">法人证书图片:</label><input type="file" class="form-control" accept="image/*" style="font-size: 13px;" value="请选择上传图片" id="certificateInput">
					</div>
				</div>
				<button type="submit" class="btn btn-success btn-round btn-block shadow-sm">提交</button>
			</form>
		</div>
	</div>
</div>
<!-- End Main -->



<!--------------------------------------
JAVASCRIPTS
--------------------------------------->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/popper.min.js" type="text/javascript"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<script src="js/tool.js" type="text/javascript"></script>
<script src="js/header.js" type="text/javascript"></script>
<script src="./assets/layui/layui.js" type="text/javascript"></script>
<!-- Animation -->
<script src="vendor/aos.js" type="text/javascript"></script>
<noscript>
    <style>
        *[data-aos] {
            display: block !important;
            opacity: 1 !important;
            visibility: visible !important;
        }
    </style>
</noscript>
<script>
    AOS.init({
        duration: 700
    });
</script>

<!-- Disable animation on less than 1200px, change value if you like -->
<script>
AOS.init({
  disable: function () {
    var maxWidth = 1200;
    return window.innerWidth < maxWidth;
  }
});
</script>
<script>
	$(function (){
		var roleVal = "1";
		var parames = {};
		$('#slectRole').change(function () {
		    roleVal = $("#slectRole").val();
		    if(roleVal == "1"){
				$("#personID").removeClass("disabledNone");
				$("#License").addClass("disabledNone");
				$("#certificate").addClass("disabledNone");
				$(".inCharge").addClass("disabledNone");
				$(".personName1").removeClass("disabledNone");
				$(".personName2").addClass("disabledNone");
			}else if(roleVal == "3"||roleVal == "2"){
				$("#License").removeClass("disabledNone");
				$("#personID").addClass("disabledNone");
				$("#certificate").addClass("disabledNone");
				$(".personName1").removeClass("disabledNone");
				$(".personName2").addClass("disabledNone");
			}else if(roleVal == "4"||roleVal == "6"){
				$("#personID").addClass("disabledNone");
				$("#License").addClass("disabledNone");
				$("#certificate").removeClass("disabledNone");
				$(".personName1").addClass("disabledNone");
				$(".personName2").removeClass("disabledNone");
			}else{
				$("#personID").removeClass("disabledNone");
				$("#License").addClass("disabledNone");
				$("#certificate").addClass("disabledNone");
				$(".inCharge").removeClass("disabledNone");
				$(".personName1").removeClass("disabledNone");
				$(".personName2").addClass("disabledNone");

			}
		})
		$('#personIDFront').change(function (event) {
		    for (let i = 0; i < event.target.files.length; i++) {
		    	// 获取input上传附件
		    	let file = event.target.files[i];
				uploadFile(file,"idCardFrontFile");
		    }
		});
		$('#personIDBack').change(function (event) {
		    for (let i = 0; i < event.target.files.length; i++) {
		    	// 获取input上传附件
		    	let file = event.target.files[i];
				uploadFile(file,"idCardFrontBack");
		    }
		})
		$('#LicenseInput').change(function (event) {
		    for (let i = 0; i < event.target.files.length; i++) {
		    	// 获取input上传附件
		    	let file = event.target.files[i];
				uploadFile(file,"businessLicense");
		    }
		})
		$('#certificateInput').change(function (event) {
		    for (let i = 0; i < event.target.files.length; i++) {
		    	// 获取input上传附件
		    	let file = event.target.files[i];
				uploadFile(file,"businessLicense");
		    }
		})
		//上传附件
		function uploadFile(file,name) {
		   var form = new FormData();
		   form.append('file', file);
		   $.ajax({
       		timeout:30000,
		   	type:'POST',
		   	url:window.Http+"/common/upload",
		   	headers: {
		   	　　'Authorization':"Bearer "+sessionStorage.getItem('Token')
		   	},
		   	data:form,
		   	mimeType:"multipart/form-data",
		   	contentType:false,
		   	processData:false,
			dataType:"json",
		   	success:function (res){
				if(res.code == 200){
					parames[name] = res.url;
				}else{
					layer.msg(res.msg);
				}

		   	},
		   	error:function(err){
		   		layer.msg(err.msg);
		   	}
		   })
		};


		$('#form1').on('submit', function (e) {
		  e.preventDefault();
		  switch (roleVal){
		  	case "1":parames.proveType = 1;break;
			case "2":parames.proveType = 2;break;
			case "3":parames.proveType = 3;break;
			case "4":parames.proveType = 4;break;
			case "5":parames.proveType = 5;break;
			case "6":parames.proveType = 6;break;
			case "7":parames.proveType = 7;break;
		  	default:break;
		  }
		  parames.reProve = sessionStorage.getItem('reProve')
		  parames.realName = $("#personNameInput").val();
		  console.log(parames)
		  $.ajax({
       		timeout:30000,
		  	type:'POST',
		  	url:window.Http+"/prove/apply",
			headers: {
			　　'Authorization':"Bearer "+sessionStorage.getItem('Token')
			},
		  	data:JSON.stringify(parames),
		  	contentType: 'application/json;charset=utf-8',
		  	success:function (res){
				if(res.code == 200){
					layer.msg(res.msg);
					setTimeout(()=>{
						window.location.href = './index.html';
					},1500)
				}else{
					layer.msg(res.msg);
				}

		  	},
		  	error:function(err){
		  		layer.msg(err.msg);
		  	}
		  })

		})
	})

</script>
</body>
</html>
